import * as constants from './contants';
import { fromJS } from 'immutable';


const defaultState = fromJS({ 'registerData': null });

const getData = (state, action) => state.setData('registerData', action.data);

 // 由于state 是引用类型，不能直接修改，否则监测不到 state 发生变化。所以先拷贝一份，进行编辑
const reducer = (state = defaultState, action) => {
    switch(action.type) {
        case constants.SET_DATA :
            return getData(state, action);
        default: 
            return state;
    }
}

export default reducer;